<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>EquTemper: Implementation</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="$relpath<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="$relpath<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>/search.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">EquTemper&#160;<span id="projectnumber">1.01</span></div>
   <div id="projectbrief">An equation editor.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<script type="text/javascript">
function hasClass(ele,cls) {
  return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}

function addClass(ele,cls) {
  if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}

function removeClass(ele,cls) {
  if (hasClass(ele,cls)) {
    var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
    ele.className=ele.className.replace(reg,' ');
  }
}

function toggleVisibility(linkObj) {
 var base = linkObj.getAttribute('id');
 var summary = document.getElementById(base + '-summary');
 var content = document.getElementById(base + '-content');
 var trigger = document.getElementById(base + '-trigger');
 if ( hasClass(linkObj,'closed') ) {
   summary.style.display = 'none';
   content.style.display = 'block';
   trigger.src = 'open.png';
   removeClass(linkObj,'closed');
   addClass(linkObj,'opened');
 } else if ( hasClass(linkObj,'opened') ) {
   summary.style.display = 'block';
   content.style.display = 'none';
   trigger.src = 'closed.png';
   removeClass(linkObj,'opened');
   addClass(linkObj,'closed');
 }
 return false;
}
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('debug_implementation.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">Implementation </div>  </div>
</div>
<div class="contents">
<div class="textblock"><p>The goal of the module is to present the content of the application in a standard way, ready to be displayed by various widgets that understand <a href="http://doc.qt.nokia.com/latest/model-view-programming.html">the model/view</a> concept from <a href="https://qt.nokia.com/products/">Qt</a>.</p>
<p>The execution goes like this: the application initialises itself by creating an widget capable of displayng the model and calls <a class="el" href="class_d_d_h_c_1_1_model.html#a087ceafaf5b66acd8a31094d9626a2a2" title="get the one and running instance">DDHC::Model::mInst()</a> (that will create a new instance of the model if none exists). For each class that needs to be tracked the macros must be in place as explained in <a class="el" href="sec_interface.html">Interface section</a>. When a class instance is created it calls <a class="el" href="class_d_d_h_c_1_1_ghost.html#ad94850f51b4c9e865b7f0a72ea5d438b" title="since we can&#39;t initialise in constructor, do it with this call">DDHC::Ghost::_ddhc_init()</a> that inserts the instance in the classes chain and as top level in tree. If the instance has a parent, then it is free to reparent the instance to itself. When variables are added, they are placed as kids of the two associated items.</p>
<h2><a class="anchor" id="sec_model"></a>
The model</h2>
<p>To achieve specified goal a class inheriting from <a href="http://doc.qt.nokia.com/latest/qabstractitemmodel.html">QAbstractItemModel</a> needs to be defined. It is the <a class="el" href="class_d_d_h_c_1_1_model.html" title="class representing the root for all debug elements">DDHC::Model</a> that, beside having the role to expose a standard interface usable by widgets also acts as central class.</p>
<p>Only one instance of this class is needed and allowed. External world calls <a class="el" href="class_d_d_h_c_1_1_model.html#a087ceafaf5b66acd8a31094d9626a2a2" title="get the one and running instance">DDHC::Model::mInst()</a> and this either constructs one or returns the existing one.</p>
<p>The class embedds a <a class="el" href="class_d_d_h_c_1_1_tree.html">DDHC::Tree</a> class and a <a class="el" href="class_d_d_h_c_1_1_classes.html" title="embedded inside the DDHC::Model class; manages instances grouped by class name">DDHC::Classes</a>, first handling the hierarchical tree fo items while second groups all classes and all instances created from each class.</p>
<p>To support the management of the items, the class provides functions to add elements to the model, both in list and in the tree.</p>
<h2><a class="anchor" id="sec_item"></a>
Model items</h2>
<p><a class="el" href="class_d_d_h_c_1_1_mdl_item.html" title="the QModelIndex has internalPointer() either NULL or pointing to a class tha inherits this one...">DDHC::MdlItem</a> provides a base class for all items that are part of the tree presented by <a class="el" href="class_d_d_h_c_1_1_model.html" title="class representing the root for all debug elements">DDHC::Model</a>. Beside the usual management functions for chain manipulation, the class requests it's inheritants to implement <a class="el" href="class_d_d_h_c_1_1_mdl_item.html#a3a0f603992a06338cde961bbf14f5b2c" title="data associated with column i_nth">DDHC::MdlItem::data()</a> function. The implementation needs to examine the column that is requested and to properly return a value (that may be QVariant() if nothing is to be returned).</p>
<h3><a class="anchor" id="ssec_classes"></a>
Classes item</h3>
<p>One instance of <a class="el" href="class_d_d_h_c_1_1_classes.html" title="embedded inside the DDHC::Model class; manages instances grouped by class name">DDHC::Classes</a> is embedded inside the <a class="el" href="class_d_d_h_c_1_1_model.html" title="class representing the root for all debug elements">DDHC::Model</a> class. Its purpose is to manage a list of all classes that were ever added to DDHC. The class is the parent of all <a class="el" href="class_d_d_h_c_1_1_a_class.html">DDHC::AClass</a> instances. The model forwards requests to add instances to chain using <a class="el" href="class_d_d_h_c_1_1_classes.html#a65dfa07ef2f8214c03c1de6f4c8e6cfc" title="finds this class; if it is not found creates a new entry">DDHC::Classes::registerClass()</a> function that looks up that class name. If it finds one it will append the instance there and if it doesn't will create a new <a class="el" href="class_d_d_h_c_1_1_a_class.html">DDHC::AClass</a> to host that instance.</p>
<p><a class="el" href="class_d_d_h_c_1_1_a_class.html">DDHC::AClass</a> represents a class that was defined in code. It is always parented inside a <a class="el" href="class_d_d_h_c_1_1_classes.html" title="embedded inside the DDHC::Model class; manages instances grouped by class name">DDHC::Classes</a> instance and it's purpose is to show the class name in the list of classes. Instances are rooted inside this one.</p>
<h3><a class="anchor" id="ssec_tree"></a>
Tree item</h3>
<p>At the same level as <a class="el" href="class_d_d_h_c_1_1_classes.html" title="embedded inside the DDHC::Model class; manages instances grouped by class name">DDHC::Classes</a> and also embedded inside the <a class="el" href="class_d_d_h_c_1_1_model.html" title="class representing the root for all debug elements">DDHC::Model</a> class is <a class="el" href="class_d_d_h_c_1_1_tree.html">DDHC::Tree</a>. It provides a parent for top level <a class="el" href="class_d_d_h_c_1_1_c_inst.html" title="a container for class instances that inherit from DDHC:Ghost">DDHC::CInst</a> instances and presents a hierarchical view of the class instances. The model forwards requests to append top level instances to <a class="el" href="class_d_d_h_c_1_1_tree.html#a92c271d065c25955d8fa540f8b37ece4" title="inserts an item as last kid">DDHC::Tree::append</a> with a pointer to a <a class="el" href="class_d_d_h_c_1_1_ghost.html" title="class to be inherited by the classes that need to be tracked">DDHC::Ghost</a> class.</p>
<h3><a class="anchor" id="ssec_comp"></a>
Leaf components</h3>
<p><a class="el" href="class_d_d_h_c_1_1_c_inst.html" title="a container for class instances that inherit from DDHC:Ghost">DDHC::CInst</a> is a container for class instances that inherit from DDHC:Ghost. It is always parented inside:</p>
<ul>
<li>another <a class="el" href="class_d_d_h_c_1_1_c_inst.html" title="a container for class instances that inherit from DDHC:Ghost">DDHC::CInst</a></li>
<li>a <a class="el" href="class_d_d_h_c_1_1_a_class.html">DDHC::AClass</a></li>
<li>(if top level) in <a class="el" href="class_d_d_h_c_1_1_tree.html">DDHC::Tree</a>.</li>
</ul>
<p><a class="el" href="class_d_d_h_c_1_1_c_inst.html" title="a container for class instances that inherit from DDHC:Ghost">DDHC::CInst</a> may contain, along with child <a class="el" href="class_d_d_h_c_1_1_c_inst.html" title="a container for class instances that inherit from DDHC:Ghost">DDHC::CInst</a> instances, <a class="el" href="class_d_d_h_c_1_1_var_inst.html" title="class representing a variable stored inside a class">DDHC::VarInst</a> representing the data that DDHC:Ghost inheriting class has inside. This provides the developer with a view directly at the data that makes a class.</p>
<h2><a class="anchor" id="sec_ghost"></a>
The Ghost</h2>
<p>This class is the one inherited by classes that are monitored. It is an abstract class in that it contains a number of purelly virtual methods that make the instantiation of this class by it's own impossible.</p>
<p><a class="el" href="class_d_d_h_c_1_1_ghost.html#ad94850f51b4c9e865b7f0a72ea5d438b" title="since we can&#39;t initialise in constructor, do it with this call">DDHC::Ghost::_ddhc_init()</a> is called from inside the inheriting class to initialise the instance. The function is part of the DDHC_CONSTRUCT macro. It inserts the instance in it's class chain and in the tree as top node. The parent may choose to move to a more proper location later using the DDHC_NODE macro.</p>
<p>The inheriting class needs to implement <a class="el" href="class_d_d_h_c_1_1_ghost.html#a5303ef30e89e52a531422bfaec8e7c4b" title="returns the class name">DDHC::Ghost::_ddhc_Name()</a> to tell the name of the class (stored by the DDHC_CONTENT as a static memeber). DDHC::Ghost::_ddhc_Assoc() and DDHC::Ghost::_ddhc_SetAssoc() are used to get / save the pointer to the tree instance (CInst inside the hierarchical tree) that hosts this ghost.</p>
<p><a class="el" href="class_d_d_h_c_1_1_ghost.html#a4b11695af9e070175df2d95623ca35b7">DDHC::Ghost::_ddhc_appendVar()</a> adds an internal variable to this class representation and DDHC::Ghost::_ddhc_appendClass() reparents a class (that also inherits from Ghost class) to this class. </p>
</div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="main.html">EquTemper source code documentation</a>      </li>
      <li class="navelem"><a class="el" href="ddhc_main_page.html">Dynamic Debug Helper Code (DDHC)</a>      </li>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

    <li class="footer">Generated on Sun Oct 23 2011 22:06:49 for EquTemper by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </li>
   </ul>
 </div>
</body>
</html>
